
/*
 * Class ItemOption3
 *
 * Version 1.0
 *
 * Sunday, May 9, 2010.
 *
 * Created by Drowning
 */

package palidino76.rs2.io.packets;

import palidino76.rs2.*;
import palidino76.rs2.player.misc.*;
import palidino76.rs2.player.Player;
import palidino76.rs2.player.items.PlayerItems;
import palidino76.rs2.util.Misc;
import palidino76.rs2.util.ByteVector;

public class ItemOption3 implements Packet {
    /**
     * Handles first item options, excluding things such as eating and drinking.
     * @param p The Player which the frame should be handled for.
     * @param packetId The packet id this belongs to.
     * @param packetSize The amount of bytes being recieved for this packet.
     */
    public void handlePacket(Player p, int packetId, int packetSize) {
        if (p == null || p.stream == null) {
            return;
        }
        int itemSlot = p.stream.readUnsignedWordBigEndianA();
        int interfaceId = p.stream.readUnsignedWord();
        int junk = p.stream.readUnsignedWord();
        int itemId = p.stream.readUnsignedWord();
		PlayerItems pi = new PlayerItems();
        if (itemSlot < 0 || itemId < 0) {
            return;
        }
        switch (interfaceId) {
/*
		case 2424:
		if (p.absY >= 3672 && Server.engine.wildernessArea(p.absX, p.absY)) {
			p.frames.sendMessage(p, "You cannot teleport above 20 wilderness!");
		} else if (p.AtCastleWars() || p.AtPits() || p.duelFight() || p.inBounty) {
			p.frames.sendMessage(p, "You cannot operate this at this time.");
		} else {
		p.frames.sendMessage(p, "You rub the ring...");
		p.ROD = 1;
		p.GN = 0;
		p.AOG = 0;
		p.disconnected[0] = false;
		p.frames.setString(p, "Choose a teleport", 233, 1);
		p.frames.setString(p, "Duel Arena", 233, 2);//
		p.frames.setString(p, "Fight Pits", 233, 3);//
		p.frames.setString(p, "Shantay Pass", 233, 4);//
		p.frames.setString(p, "CastleWars", 233, 5);//
		p.frames.showChatboxInterface(p, 233);
		}
		break;

		case 3981:
		if (p.absY >= 3672 && Server.engine.wildernessArea(p.absX, p.absY)) {
			p.frames.sendMessage(p, "You cannot teleport above 20 wilderness!");
		} else if (p.AtCastleWars() || p.AtPits() || p.duelFight() || p.inBounty) {
			p.frames.sendMessage(p, "You cannot operate this at this time.");
		} else {
		p.frames.sendMessage(p, "You rub the necklace...");
		p.GN = 1;
		p.ROD = 0;
		p.AOG = 0;
		p.disconnected[0] = false;
		p.frames.setString(p, "Choose a teleport", 233, 1);
		p.frames.setString(p, "Warriors Guild", 233, 2);//
		p.frames.setString(p, "Bounty Hunter", 233, 3);//
		p.frames.setString(p, "God Wars", 233, 4);//
		p.frames.setString(p, "KBD", 233, 5);//
		p.frames.showChatboxInterface(p, 233);
		}
		break;
*/
case 12175://Spirit Wolf
		    if (p.FamiliarID > 0) {
				p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
		    } else {
				Engine.playerItems.deleteItem(p, 12047, itemSlot, 1);
				p.frames.sendMessage(p, "You summon a Spirit Wolf.");
				p.frames.setTab(p, 80, 663);
				p.frames.animateInterfaceId(p, 9850, 663, 3);
				p.frames.setNPCId(p, 6829, 663, 3);
				Engine.newNPC(6829, p.absX, p.absY +1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
				p.addSkillXP(400, 23);

		    }
				break;

		case 12171://DreadFowl
		    if (p.skillLvl[23] > 3) {
		      if (p.FamiliarID > 0) {
				p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
		      } else {
				Engine.playerItems.deleteItem(p, 12043, itemSlot, 1); 
				p.frames.sendMessage(p, "You summon a Dread Fowl");
				p.frames.setTab(p, 80, 663);
				p.frames.animateInterfaceId(p, 9850, 663, 3);
				p.frames.setNPCId(p, 6825, 663, 3);
				Engine.newNPC(6825, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
				p.addSkillXP(700, 23);
		      }

		    } else {
			p.frames.sendMessage(p, "You need at least level 4 summoning to summon that.");	
		    }
				break;

		case 12187://Spirit Spider
		    if (p.skillLvl[23] > 9) {
		      if (p.FamiliarID > 0) {
				p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
		      } else {
				Engine.playerItems.deleteItem(p, 12059, itemSlot, 1); 
				p.frames.sendMessage(p, "You summon a Spirit Spider");
				p.frames.setTab(p, 80, 663);
				p.frames.animateInterfaceId(p, 9850, 663, 3);
				p.frames.setNPCId(p, 6841, 663, 3);
				Engine.newNPC(6841, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
				p.addSkillXP(5000, 23);
		      }

		    } else {
			p.frames.sendMessage(p, "You need at least level 10 summoning to summon that.");	
		    }
				break;

case 11891://Thorny Snail
if (p.skillLvl[23] > 12) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12019, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Thorny snail.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 6806, 663, 3);
Engine.newNPC(6806, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(6000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 13 summoning to summon that.");	
}
break;

case 12936://Spirit Tz-Kih
if (p.skillLvl[23] > 21) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12808, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Spirit Tz-Kih.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 7361, 663, 3);
Engine.newNPC(7361, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(7000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 22 summoning to summon that.");	
}
break;

case 12201://Bronze Minotour
if (p.skillLvl[23] > 35) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12073, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Bronze Minotour.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 6853, 663, 3);
Engine.newNPC(6853, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(8000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 36 summoning to summon that.");	
}
break;

case 12203://Iron Minotour
if (p.skillLvl[23] > 45) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12075, itemSlot, 1); 
p.frames.sendMessage(p, "You summon an Iron Minotour.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 6855, 663, 3);
Engine.newNPC(6855, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(10000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 46 summoning to summon that.");	
}
break;

case 12205://Steel Minotour
if (p.skillLvl[23] > 55) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12077, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Steel Minotour.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 6857, 663, 3);
Engine.newNPC(6857, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(12000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 56 summoning to summon that.");	
}
break;

case 12207://Mithril Minotour
if (p.skillLvl[23] > 65) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12079, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Mithril Minotour.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 6859, 663, 3);
Engine.newNPC(6859, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(14000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 66 summoning to summon that.");	
}
break;

case 12209://Adamant Minotour
if (p.skillLvl[23] > 75) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12081, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Adamant Minotour.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 6861, 663, 3);
Engine.newNPC(6861, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(16000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 76 summoning to summon that.");	
}
break;

case 12211://Rune Minotour
if (p.skillLvl[23] > 85) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12083, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Rune Minotour.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 6863, 663, 3);
Engine.newNPC(6863, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(26000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 86 summoning to summon that.");	
}
break;

case 12930://Fire Titan
if (p.skillLvl[23] > 78) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12802, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Fire Titan.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 7355, 663, 3);
Engine.newNPC(7355, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(18000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 79 summoning to summon that.");	
}
break;

case 12932://Moss Titan
if (p.skillLvl[23] > 78) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12804, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Moss Titan.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 7357, 663, 3);
Engine.newNPC(7357, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(18000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 79 summoning to summon that.");	
}
break;

case 12934://Ice Titan
if (p.skillLvl[23] > 78) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12806, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Ice Titan.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 7359, 663, 3);
Engine.newNPC(7359, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(18000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 79 summoning to summon that.");	
}
break;

case 12660://Lava Titan
if (p.skillLvl[23] > 82) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12788, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Lava Titan.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 7341, 663, 3);
Engine.newNPC(7341, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(20000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 83 summoning to summon that.");	
}
break;

case 12648://Swamp Titan
if (p.skillLvl[23] > 84) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12776, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Swamp Titan.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 7329, 663, 3);
Engine.newNPC(7329, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(22500, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 85 summoning to summon that.");	
}
break;



case 12658://Geyser Titan
if (p.skillLvl[23] > 88) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12786, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Geyser Titan.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 7339, 663, 3);
Engine.newNPC(7339, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(25000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 89 summoning to summon that.");	
}
break;

case 12668://Abyssal Titan
if (p.skillLvl[23] > 92) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12796, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Abyssal Titan.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 7349, 663, 3);
Engine.newNPC(7349, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(28000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 93 summoning to summon that.");	
}
break;

case 12950://Iron Titan
if (p.skillLvl[23] > 94) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12822, itemSlot, 1); 
p.frames.sendMessage(p, "You summon an Iron Titan.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 7375, 663, 3);
Engine.newNPC(7375, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(30000, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 95 summoning to summon that.");	
}
break;
case 12662://Steel Titan
if (p.skillLvl[23] > 98) {
if(p.FamiliarID > 0)
{
p.frames.sendMessage(p, "You cannot summon more than one familiar at a time.");	
}
else
{
Engine.playerItems.deleteItem(p, 12790, itemSlot, 1); 
p.frames.sendMessage(p, "You summon a Steel Titan.");
p.frames.setTab(p, 80, 663);
p.frames.animateInterfaceId(p, 9850, 663, 3);
p.frames.setNPCId(p, 7343, 663, 3);
Engine.newNPC(7343, p.absX, p.absY+1, p.heightLevel, p.absX + 1, p.absY + 1, p.absX + -1, p.absY + -1, false, p.playerId);
p.addSkillXP(10, 23);

}
}
else
{
p.frames.sendMessage(p, "You need at least level 99 summoning to summon that.");	
}
break;
/*
		case 1584:
		if (p.absY >= 3672 && Server.engine.wildernessArea(p.absX, p.absY)) {
			p.frames.sendMessage(p, "You cannot teleport above 20 wilderness!");
		} else if (p.AtCastleWars() || p.AtPits() || p.duelFight() || p.inBounty) {
			p.frames.sendMessage(p, "You cannot operate this at this time.");
		} else {
		p.frames.sendMessage(p, "You rub the necklace...");
		p.AOG = 1;
		p.GN = 0;
		p.ROD = 0;
		p.disconnected[0] = false;
		p.frames.setString(p, "Choose a teleport", 233, 1);
		p.frames.setString(p, "Agility Course", 233, 2);//
		p.frames.setString(p, "Grand Exchange", 233, 3);//
		p.frames.setString(p, "Edgeville", 233, 4);//
		p.frames.setString(p, "Catherby", 233, 5);//
		p.frames.showChatboxInterface(p, 233);
		}
		break;
*/
        default:
            Misc.println("[" + p.username + "] Item option 3: " + interfaceId);
            break;
        }
    }
}
